window.onload = function () {
    $('.suc-mon').click(function(){
      $('.suc-mon').css('display','none')
    })
    var hotSwiper = new Swiper('.hot-swiper-container', {
      slidesPerView: 2.3,
      autoplayDisableOnInteraction: false,
        direction: 'horizontal',
        paginationClickable: true,
        slideToClickedSlide: true,
        
    });
    var commonSwiper = new Swiper('.common-swiper-container', {
      slidesPerView: 2.1,
      spaceBetween: 30,
      pagination: {
        el: '.hot-swiper-pagination',
        clickable: true,
      },
    });

    var expertSwiper = new Swiper('.expert-swiper-container', {
      slidesPerView: 2.15,
      spaceBetween: 30,
      pagination: {
        el: '.expert-swiper-pagination',
        clickable: true,
      },
    });
	
	   var aswiper = new Swiper('.swiper-container', {
        direction: 'vertical',
        slidesPerView: 'auto',
        freeMode: true,
        scrollbar: {
            el: '.swiper-scrollbar',
        },
        mousewheel: true,
    });
}
     var sCon = '';
  var thirdCon ='';
    // 拜师弹窗
function master(recommend_id,nickname,user_id,user_name) {

    var _this = this;
    var bsCon  = '<div class="bs">'
    +'<img src="/App/Home/Public/images/baishi1.png">'
    +'<img class="guanbi" src="/App/Home/Public/images/guanbi .png">'
    +'<div class="bs-con">'
    +' <p>徒弟<span>'+user_name+'</span>仰慕师傅德</p><p>才兼备<br/>，<br/>在网贷理财上具备独到</p><p>的目光<br/>。<br/>徒弟愿从今日起<br/>，拜</p><p><span>“<br/>'+nickname+'<br/>”<br/></span>为师<br/>。</p><p>日后跟随师傅脚步<br/>，<br/>关注师傅动</p><p>态<br/>，<br/>提升网贷理财知识<br/>，<br/>提高避</p><p>雷意识<br/>。<br/></p>'
    +'</div>'
    +' <div class="bs-btn">'
    +'<p class="kaolv" onclick="to_close()">我再考虑考虑</p>'
    +' <p class="chengshang" onclick="to_fans('+recommend_id+')">呈上拜师帖</p>'
    +' </div>'
    +'</div>';
          // $(this).addClass('active');
          // $(this).html('已拜师');
       
          // layer.open({
          //   content: bsCon
          // });
        $('.baishitie').css('display','block');
            $('.baishitie').append(bsCon);
        $('.baishitie').click(function(){
          $('.baishitie').css('display','none');
        })   

              sCon = '<div class="s-item"><div class="s-title">'
    +'<img src="/App/Home/Public/images/baishi-suc.png">'
    +'</div>'
    +'<div class="s-con">'
     +' <p>恭喜您已成为</p>'
      +'<p><span>'+nickname+'</span>的徒弟</p>'
    +'</div>'
    +'<div class="s-mon">'
      +'<p>+50金币</p>'
    +'</div>'
    +'<a class="s-btn" href="/Home/person/center/id/'+user_id+'" ><p>领取师傅红包</p></ a></div>';

            thirdCon = '<div class="s-item"><div class="s-title">'
      +'<img src="/App/Home/Public/images/baishi-suc.png">'
    +'</div>'
    +'<div class="s-con third-con">'
     +' <p>恭喜您已成为</p>'
      +'<p><span>'+nickname+'</span>的徒弟</p>'
    +'</div>'
    +'<a class="s-btn third-btn" href="/Home/person/center/id/'+user_id+'" ><p>领取师傅红包</p></ a></div>';


};


      function to_fans(recommend_id){
         $.post('/Home/Recommend/recommend_fllow',{
          recommend_id:recommend_id,
          val:1,
         },function(res){
          if(res.err==2){
            layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 2
                ,end:function(){location.href='/Home/User/login'}
            });
          }else if(res.err==3) {
            layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 2
            });
          }else if(res.err==4) {
            layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 2
            });
          }else{
            if(res.err==999){
              $('.suc-mon').html('')
            $('.suc-mon').css('display','block');
            $('.suc-mon').append(sCon);
              $('.suc-mon').click(function(){
                $('.suc-mone').css('display','none');
              })
            }else{
              $('.suc-mon').html('')
            $('.suc-mon').css('display','block');
            $('.suc-mon').append(thirdCon);
              $('.suc-mon').click(function(){
                $('.suc-mone').css('display','none');
              })
            }
          }
         })

      }



      function to_close() {
        layer.closeAll();
      }
  